package com.zhuss.common;

import io.swagger.annotations.ApiModelProperty;

import java.util.ArrayList;
import java.util.List;

import com.zhuss.bean.unit.core.company.CompanyBean;
import com.zhuss.bean.unit.core.user.UserBean;
import com.zhuss.util.HeaderUtil;


public class AbstractBo implements AbstractEntity {
	
	@ApiModelProperty(hidden = true)
	private String concurrentToken;
	
	@ApiModelProperty(hidden = true)
	private Long concurrentUserId;;
	
	@ApiModelProperty(hidden = true)
	private Integer concurrentSystem;
	
	@ApiModelProperty(hidden = true)
	private List<Long> concurrentDeptIdList = new ArrayList<>();
	
	@ApiModelProperty(hidden = true)
	private Long concurrentCompanyId;
	
	@ApiModelProperty(hidden = true)
	private UserBean concurrentUser;
	
	@ApiModelProperty(hidden = true)
	private CompanyBean concurrentCompany;
	
	@ApiModelProperty(hidden = true)
	private String exceptionReason;
	
	public Long getConcurrentUserId() {
		if (concurrentUserId == null) {
			concurrentUserId = HeaderUtil.getCurrentUserId();
		}
		return concurrentUserId;
	}

	public void setConcurrentUserId(Long concurrentUserId) {
		this.concurrentUserId = concurrentUserId;
	}

	public Integer getConcurrentSystem() {
		if (concurrentSystem == null) {
			concurrentSystem = HeaderUtil.getCurrentSystem();
		}
		return concurrentSystem;
	}

	public void setConcurrentSystem(Integer concurrentSystem) {
		this.concurrentSystem = concurrentSystem;
	}

	public Long getConcurrentCompanyId() {
		concurrentCompanyId = null;
		if (concurrentCompany != null) {
			return concurrentCompany.getCompanyId();
		}
		return concurrentCompanyId;
	}

	public void setConcurrentCompanyId(Long concurrentCompanyId) {
		this.concurrentCompanyId = concurrentCompanyId;
	}

	public String getExceptionReason() {
		return exceptionReason;
	}

	public void setExceptionReason(String exceptionReason) {
		this.exceptionReason = exceptionReason;
	}

	public String getConcurrentToken() {
		if (concurrentToken == null) {
			concurrentToken = HeaderUtil.getCurrentToken();
		}
		return concurrentToken;
	}

	public void setConcurrentToken(String concurrentToken) {
		this.concurrentToken = concurrentToken;
	}

	public UserBean getConcurrentUser() {
		return concurrentUser;
	}

	public void setConcurrentUser(UserBean concurrentUser) {
		this.concurrentUser = concurrentUser;
	}
	
	public CompanyBean getConcurrentCompany() {
		return concurrentCompany;
	}

	public void setConcurrentCompany(CompanyBean concurrentCompany) {
		this.concurrentCompany = concurrentCompany;
	}

	public List<Long> getConcurrentDeptIdList() {
		if (concurrentUser != null) {
			concurrentDeptIdList = concurrentUser.getDeptIdList();
		}
		return concurrentDeptIdList;
	}

	public void setConcurrentDeptIdList(List<Long> concurrentDeptIdList) {
		this.concurrentDeptIdList = concurrentDeptIdList;
	}
	
	@ApiModelProperty(hidden = true)
	public String getConcurrentUserName() {
		if (concurrentUser != null) {
			return concurrentUser.getName();
		}
		return "";
	}

}
